package com.yasaka.stock.common;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.MessageFormat;




public class BiyingTranslate {
	
	private static String CBIYINGURL = "http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=35F38F88C69B56041C6974EB1271E73154D6D8D5&from={0}&to={1}&text={2}";
	
	public static String translate(String aText, String aFrom, String aTo) throws UnsupportedEncodingException {
        
		String mResult = HttpGet.get(MessageFormat.format(CBIYINGURL,
					URLEncoder.encode(aFrom,"UTF-8"),
					URLEncoder.encode(aTo,"UTF-8"),					
					URLEncoder.encode(aText, "UTF-8")),null);		
			return mResult.substring(2, mResult.length() -1);
    }
	

}
